<include file="Common:header" />
<div class="layui-card layadmin-header"> <span class="layui-breadcrumb" lay-filter="menu" lay-separator="/"> <a href="{:U('Index/welcome')}">首页</a> <a href="{:U('Setting/index')}">系统参数管理</a> <a href="javascript:;" class="addButton">添加一项</a></span> </div>

<div class="layui-fluid pt-10 pr-10 pl-20">
	<form class="layui-form" name="addForm" id="addForm" method="post" action="{:U('Setting/index')}">
		<div class="layui-form">
			<table class="layui-table">
				<thead>
					<tr>
						<th style="text-align:center">配置名</th>
						<th style="text-align:center">配置唯一标识</th>
						<th style="text-align:center">配置值</th>
						<th style="text-align:center">操作</th>
					</tr>
				</thead>
				<tbody id="Container">
					<foreach name="data" item="val">
						<tr>
							<td><input type="text" name="text[]" value="{$val['text']}" class="layui-input" /></td>
							<td><input type="text" name="key[]" value="{$val['key']}" class="layui-input" /></td>
							<td><input type="text" name="value[]" value="{$val['value']}" class="layui-input" /></td>
							<td style="text-align:center"><a class="layui-btn layui-btn-primary layui-btn-sm delButton" href="javascript:;"><i class="layui-icon layui-icon-delete"></i>删除</a></td>
						</tr>
					</foreach>
				</tbody>
			</table>
		</div>
		<div class="layui-form-item pt-20">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit>确认提交</button>
			</div>
		</div>
	</form>
</div>
<script>
layui.use(['jquery','element'], function(){
	var $ = layui.$;

	$(".addButton").on('click',function(){
		$('#Container').append('<tr><td><input type="text" name="text[]" class="layui-input" /></td><td><input type="text" name="key[]" class="layui-input" /></td><td><input type="text" name="value[]" class="layui-input" /></td><td><a class="layui-btn layui-btn-primary layui-btn-sm delButton" href="javascript:;"><i class="layui-icon layui-icon-delete"></i>删除</a</td></tr>');
	});

	$("#Container").on('click','.delButton',function(){
		$(this).parents('tr').remove();
	});
	
});
</script>
<include file="Common:footer" />